class HomeController < ApplicationController

	caches_page :index

	before_filter :set_bottomlinks
	before_filter :set_toplinks
	before_filter :set_about
	before_filter :set_contact_us
	before_filter :set_our_services
	before_filter :set_menu
	before_filter :set_current_top_category

  def index
		@home1 = Article.ez_find(:all, :include => [:category,:tags,:taggings], :order => "published_at") do |article, category, tag, tagging|
      article.published == 1
			tag.name == 'home1'
    end	

		@home2 = Article.ez_find(:all, :include => [:category,:tags,:taggings], :order => "published_at") do |article, category, tag, tagging|
      article.published == 1
			tag.name == 'home2'
    end
	end
	
	def contact
    return unless request.post?
    message = params[:message]
    send_email(message)
    flash[:notice] = "Votre message a été envoyé correctement."
    redirect_to home_url
  end

	def mailer
    return unless request.post?
    message = params[:message]
    send_email(message)
    flash[:notice] = "Votre message a été envoyé correctement."
    redirect_to home_url
  end
	
end
